<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <dage @send="getData"></dage>
    <hr>
    <erdi :mydage="dageSend"></erdi>
  </div>
  <!-- 大哥的模板 -->
  <template id="dage">
    <div>
      <h1>大哥部分</h1>
    </div>
  </template>
  <!-- 二弟的模板 -->
  <template id="erdi">
    <div>
      <h1>二弟部分</h1>
      <h1>大哥说：{{mydage}}</h1>
    </div>
  </template>
  <script src="./vue.js"></script>
  <script>
    var vm = new Vue({
      el: "#app",
      data() {
        return {
          dageSend: ""
        }
      },
      methods: {
        getData(a) {
          this.dageSend = a;//存储大哥传来的数据
        }
      },
      components: {
        dage: {
          template: "#dage",
          data() {
            return {
              dData: "二弟救我"
            }
          },
          mounted() {
            this.$emit("send", this.dData)
          },
        },
        erdi: {
          template: "#erdi",
          props: ["mydage"],
          data() {
            return {
              erdiData: "大哥等我"
            }
          }
        }
      }
    })





  </script>
</body>

</html>